package com.cyt.web.controller.work.wxassocationnewDetail;

import com.cyt.base.enums.BusinessType;
import com.cyt.base.enums.OperatorType;
import com.cyt.base.model.dto.ReturnResult;
import com.cyt.work.association.model.vo.WxAssociationNewDetailVo;
import com.cyt.work.association.service.WxAssociationNewDetailService;
import com.cyt.sys.aspect.BaseLog;
import com.cyt.web.controller.base.BaseController;
import org.apache.commons.lang3.StringUtils;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 招新关联社团表-招新关联社团表控制层
 *
 * @author han jun
 * @date 2019-9-3 16:42:35
 */
@RestController
public class WxAssociationNewDetailController extends BaseController {

    @Resource
    private WxAssociationNewDetailService wxAssociationNewDetailService;
    
    /**
     * 统一跳转
     *
     * @param model 数据模型
     * @return Model
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @RequestMapping("/work/wxassocationnewDetail/wxassociationnewdetail/*")
    public Model goPage(Model model) {
        return model;
    }

    /**
     * 分页查询
     *
     * @param wxAssociationNewDetailVo 接受参数对象
     * @param page 分页数
     * @param limit 每页显示条数
     * @return ReturnResult
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @BaseLog(module = "招新关联社团表", classz = "招新关联社团表", methods = "分页查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/wxassocationnewDetail/wxassociationnewdetail/findPage", method = RequestMethod.POST)
    public ReturnResult findPage(WxAssociationNewDetailVo wxAssociationNewDetailVo, int page, int limit) {
        return wxAssociationNewDetailService.findPage(wxAssociationNewDetailVo, page, limit);
    }

    /**
     * 分页查询
     *
     * @param wxAssociationNewDetailVo 接受参数对象
     * @param page 分页数
     * @param limit 每页显示条数
     * @return ReturnResult
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @BaseLog(module = "招新关联社团表", classz = "招新关联社团表", methods = "分页查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/wxassocationnewDetail/wxassociationnewdetail/findVoPage", method = RequestMethod.POST)
    public ReturnResult findVoPage(WxAssociationNewDetailVo wxAssociationNewDetailVo, int page, int limit) {
        return wxAssociationNewDetailService.findVoPage(wxAssociationNewDetailVo, page, limit);
    }

    /**
     * list查询
     *
     * @param wxAssociationNewDetailVo 接受参数对象
     * @return ReturnResult
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @BaseLog(module = "招新关联社团表", classz = "招新关联社团表", methods = "list查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/wxassocationnewDetail/wxassociationnewdetail/findList", method = RequestMethod.POST)
    public ReturnResult findList(WxAssociationNewDetailVo wxAssociationNewDetailVo) {
        return new ReturnResult(wxAssociationNewDetailService.findList(wxAssociationNewDetailVo));
    }

    /**
     * list查询
     *
     * @param wxAssociationNewDetailVo 接受参数对象
     * @return ReturnResult
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @BaseLog(module = "招新关联社团表", classz = "招新关联社团表", methods = "list查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/wxassocationnewDetail/wxassociationnewdetail/findVoList", method = RequestMethod.POST)
    public ReturnResult findVoList(WxAssociationNewDetailVo wxAssociationNewDetailVo) {
        return new ReturnResult(wxAssociationNewDetailService.findVoList(wxAssociationNewDetailVo));
    }

    /**
     * 单个对象查询
     *
     * @param wxAssociationNewDetailVo 接受参数对象
     * @return ReturnResult
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @BaseLog(module = "招新关联社团表", classz = "招新关联社团表", methods = "one查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/wxassocationnewDetail/wxassociationnewdetail/findOne", method = RequestMethod.POST)
    public ReturnResult findOne(WxAssociationNewDetailVo wxAssociationNewDetailVo) {
        return new ReturnResult(wxAssociationNewDetailService.findOne(wxAssociationNewDetailVo));
    }

    /**
     * 单个对象查询
     *
     * @param wxAssociationNewDetailVo 接受参数对象
     * @return ReturnResult
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @BaseLog(module = "招新关联社团表", classz = "招新关联社团表", methods = "one查询对象", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/wxassocationnewDetail/wxassociationnewdetail/findVoOne", method = RequestMethod.POST)
    public ReturnResult findVoOne(WxAssociationNewDetailVo wxAssociationNewDetailVo) {
        return new ReturnResult(wxAssociationNewDetailService.findVoOne(wxAssociationNewDetailVo));
    }

    /**
     * 跳转添加或编辑界面
     *
     * @param wxAssociationNewDetailVo 接受参数对象
     * @return ReturnResult
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @BaseLog(module = "招新关联社团表", classz = "招新关联社团表", methods = "跳转添加或编辑界面", businessType = BusinessType.GET, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/wxassocationnewDetail/wxassociationnewdetail/getEdit", method = RequestMethod.GET)
    public ModelAndView getEdit(WxAssociationNewDetailVo wxAssociationNewDetailVo) {
        ModelAndView view = new ModelAndView("/work/wxassocationnewDetail/wxassociationnewdetail/wxAssociationNewDetailEdit");
        if (StringUtils.isNotBlank(wxAssociationNewDetailVo.getId())) {
            view.addObject(wxAssociationNewDetailService.findVoOne(wxAssociationNewDetailVo));
        }
        return view;
    }

    /**
     * 保存或更新
     *
     * @param request 请求对象
     * @param wxAssociationNewDetailVo 接受参数对象
     * @return ReturnResult
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @BaseLog(module = "招新关联社团表", classz = "招新关联社团表", methods = "保存或更新对象", businessType = BusinessType.INSERT, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/wxassocationnewDetail/wxassociationnewdetail/addOrUpdate", method = RequestMethod.POST)
    public ReturnResult addOrUpdate(HttpServletRequest request, WxAssociationNewDetailVo wxAssociationNewDetailVo) {
        return wxAssociationNewDetailService.addOrUpdate(wxAssociationNewDetailVo, acceptCurrentUser(request));
    }

    /**
     * 根据条件逻辑删除
     *
     * @param request 请求对象
     * @param wxAssociationNewDetailVo 接受参数对象
     * @return ReturnResult
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @BaseLog(module = "招新关联社团表", classz = "招新关联社团表", methods = "逻辑删除对象", businessType = BusinessType.DELETE, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/wxassocationnewDetail/wxassociationnewdetail/remove", method = RequestMethod.GET)
    public ReturnResult remove(HttpServletRequest request, WxAssociationNewDetailVo wxAssociationNewDetailVo) {
        return wxAssociationNewDetailService.remove(wxAssociationNewDetailVo, acceptCurrentUser(request));
    }

    /**
     * 根据条件物理删除
     *
     * @param request 请求对象
     * @param wxAssociationNewDetailVo 接受参数对象
     * @return ReturnResult
     * @author han jun
     * @date 2019-9-3 16:42:35
     */
    @BaseLog(module = "招新关联社团表", classz = "招新关联社团表", methods = "物理对象对象", businessType = BusinessType.DELETE, operatorType = OperatorType.MANAGE)
    @RequestMapping(value = "/work/wxassocationnewDetail/wxassociationnewdetail/delete", method = RequestMethod.GET)
    public ReturnResult delete(HttpServletRequest request, WxAssociationNewDetailVo wxAssociationNewDetailVo) {
        return wxAssociationNewDetailService.delete(wxAssociationNewDetailVo, acceptCurrentUser(request));
    }
}